from multiprocessing.pool import Pool
import os
import time

# 子进程要执行的代码
def run_proc(name):
    print('我是子进程')
    print(name)
    print(os.getpid())
    time.sleep(1)


if __name__=='__main__':
    po = Pool(3)                        # 最大进程数为3
    po.apply_async(run_proc('hello'))
    po.apply_async(run_proc('world'))
    po.apply_async(run_proc('shuoGG'))
    po.close()
    po.join()                           # 等子进程都执行完, 才结束掉主进程




